<template>
  <div class="hello">
    <input v-model="input"/><br><button type="button" @click="httppost">发送</button>
    {{msg}}
  </div>
</template>

<script>
import Http from '@/utils/Http'
export default {
  name: 'HelloWorld',
  data () {
    return {
      input: '',
      msg: ''
    }
  },
  methods: {
    // httpget () {
    //   Http.get('/api/hello', res => {
    //     this.msg = res.text
    //   })
    // },
    httppost () {
      Http.post(
        '/api/hello',
        {
          name: this.input
        },
        res => {
          this.msg = res.text
        }
      )
    }
  },
  mounted () {
  }
}
</script>

<style scoped>
  .hello{
    text-align: center;
  }
</style>
